#pragma once
/**
 * @file wawo_i2c.h
 * @author James Wang (woodsking2@hotmail.com)
 * @brief
 * @version 0.1
 * @date 2020-05-19
 *
 * Copyright (c) 2020 Walnutin Technology Company Limited. All Rights Reserved.
 *
 */
#if defined(__cplusplus)
extern "C"
{
#endif
#include "stdint.h"
#include "stdbool.h"

    /**
     * @brief start i2c
     *
     * @param clock_pin
     * @param data_pin
     * @return void*
     */
    void *wawo_i2c_initialize(int clock_pin, int data_pin);

    /**
     * @brief
     *
     * @param instance
     * @param hz
     */
    void wawo_i2c_set_frequency(void *instance, int hz);

    /**
     * @brief
     *
     * @param instance
     * @param address 8-bit address
     * @param data
     * @param length
     * @param repeated
     */
    void wawo_i2c_read(void *instance, int address, uint8_t *data, int length, bool repeated);

    /**
     * @brief
     *
     * @param instance
     * @param address 8-bit address
     * @param data
     * @param length
     * @param repeated
     */
    void wawo_i2c_write(void *instance, int address, uint8_t const *data, int length, bool repeated);

    /**
     * @brief stop i2c
     *
     * @param instance
     * @return void*
     */
    void wawo_i2c_uninitialize(void *instance);
#if defined(__cplusplus)
}
#endif
